<template>
  <!--  试验计划-查看  -->
  <div v-dialog-drag>
    <el-dialog v-dialogDrag title="附件" center :visible.sync="dialogTableVisible" width="30%">
      <el-table
        :data="seeDetails"
        border
        style="width: 100%"
        center
      >
        <el-table-column
          prop="id"
          label="序号"
          width="60"
        />
        <el-table-column
          prop="file_type"
          label="类型"
          width="100"
        />
        <el-table-column
          prop="file_name"
          label="名称"
          width="180"
        />
        <el-table-column
          label="操作"
        />
      </el-table>
      <div class="btnBox">
        <el-button class="btn" type="primary" size="mini" @click="closed()">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { seeAccessory } from '@/api/maintain'

export default {
  name: 'dialog',
  data() {
    return {
      tableData: [],
      dialogTableVisible: false,
      param: {
        offset: 0,
        limit: 20,
        task_id: ''
      },
    }
  },
  methods: {
    open(row) {
      // 修改打开弹窗的变量为true，就可以打开弹窗了
      this.dialogTableVisible = true;

      this.param.task_id = row.id;
      seeAccessory(this.param).then(res => {
        console.log(22323232)
        if (res.code == 200) {
          this.tableData = res.data.files
          this.tableData.forEach(item => {
            if (item.file_type == 1) {
              item.file_type = '图片'
            } else {
              item.file_type = '文件'
            }
          })
        }
      })
    },
    closed() {
      // this.$emit('detailes', this.closeds)
      this.dialogTableVisible = false;
    }
  }
}
</script>
<style lang="scss" scoped>
.header{
  display: inline-block;
  text-align: center;
}
.btnBox{
  width: 100%;
  display: flex;
  flex-direction: row-reverse;
  margin-top: 20px;
  // border-top:1px solid #eee;
}
/deep/.el-table .cell {
  text-align: center;
}
</style>
